<?php
	class PrivilegeModel extends Model
	{
		public function getLevelFromID($ID)
		{
			$p = $this -> where("PID = ".(string)$ID) -> find();
			return $p['level'];
		}
		public function C($name, $level=1)
		{
			/**
			 * Quick Function to get Privilege Level From Name
			 * @var $name this is the name
                         * $level if it is set to 1(default),return level, otherwise it will return PID
			 * @return Privilege Level
			 */
			$p = $this -> where('name = "'.$name.'"') -> find();
			if($level == 1)return $p['level'];
                        else return $p['PID'];
		}
	}